package com.example.lin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 评论表
 * </p>
 *
 * @author lzh
 * @since 2024-12-04
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("sys_comment")
public class Comment implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 评论id
     */
    @TableId(value = "comment_id", type = IdType.AUTO)
    private Long id;

    /**
     * 评论内容
     */
    @TableField("comment_content")
    private String content;

    /**
     * 点赞次数
     */
    @TableField("comment_praise_num")
    private Integer praiseNum;

    /**
     * 评论时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("comment_time")
    private LocalDateTime time;

    /**
     * 父级评论id
     */
    @TableField("parent_id")
    private Long parentId;

    /**
     * 评论/回复人id
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 文章id
     */
    @TableField("article_id")
    private Long articleId;
}
